#pragma once
#include<string>

const std::string opers = "+-*/%&^@";

enum
{
    ok = 0,
    div_zero,
    mod_zero,
    unknow
};

class task
{
public:
    task()
    {
    }

    task(int x, int y, char oper)
        : _x(x), _y(y), _oper(oper), _result(0), _code(ok)
    {}

    void run()
    {
        switch (_oper)
        {
        case '+':
            _result = _x + _y;
            break;
        case '-':
            _result = _x - _y;
            break;
        case '*':
            _result = _x * _y;
            break;
        case '/':
            if(_y == 0) _code = div_zero;
            else _result = _x / _y;
            break;
        case '%':
            if(_y == 0) _code = mod_zero;
            else _result = _x % _y;
            break;
        default:
            _code = unknow; 
            break;
        }
    }

    std::string ConsumerMes()
    {
        std::string s;
        s += std::to_string(_x);
        s += _oper;
        s += std::to_string(_y);
        s += '=';
        s += std::to_string(_result);
        s += "  [";
        s += std::to_string(_code);
        s += ']';

        return s;
    }

    std::string ProductorMes()
    {
        std::string s;
        s += std::to_string(_x);
        s += _oper;
        s += std::to_string(_y);
        s += '='; 
        s += '?';
    
        return s;
    }

private:
    int _x;
    int _y;
    char _oper;

    int _result;
    int _code;
};